package com.dldata.devtools30.controller.zhibiao;

import com.dldata.devtools30.entity.DevtZbobjInfoEntity;
import com.dldata.devtools30.repository.zhibiao.DevtZbobjInfoEntityDao;
import com.dldata.devtools30.service.metadata.DevtModelMetadataTypeService;
import com.dldata.devtools30.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.UUID;

@Controller
@RequestMapping(value = "/V_DevtZbobjInfoEntityController")
public class V_DevtZbobjInfoEntityController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    DevtZbobjInfoEntityDao zbobjInfoEntityDao;
    
    @RequestMapping("toIndex")
    public String toIndex(){
        
        return "thymeleaf/devtools30/zhibiao/v_zhibiaoobjIndex";
    }

    @RequestMapping("toList")
    public String toList(){

        return "thymeleaf/devtools30/zhibiao/v_zhibiaoobjList";
    }
    @RequestMapping("edit")
    public String toEdit(String id, Model model){
        id= StringUtil.isEmptyOrLength0(id)? UUID.randomUUID().toString():id;
        DevtZbobjInfoEntity entity=  zbobjInfoEntityDao.findById(id).orElse(new DevtZbobjInfoEntity());
        entity.setId(id);
        model.addAttribute("data", entity);

        return "thymeleaf/devtools30/zhibiao/v_zhibiaoobjEdit";
    }
}
